﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using QCodeLib.FileConfig;
using QCodeLib.Logger;
using QCodeLib.DbHelper;
using QCodeLib.StringHelper;
using System.Data.Common;
using System.Data;
using QCodeLib.Excel;
using QCodeLib.DataStructure;

namespace QCodeConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            #region iniFileHelper
            //IniFileHelper iniHelper = new IniFileHelper(@"c:\pm.ini");
            ////Read
            //string Value = iniHelper.IniReadValue("Country Name", "Country");
            //Console.WriteLine(Value);
            ////Write
            //iniHelper.IniWriteValue("Country Name","Country","520");
            #endregion

            #region Logger
            //Log log = new Log(10);
            //log.WriteLog_Txt("qiu");
            #endregion

            #region DBhelper,ExcelHelper
            string strConn = "Data Source=(local);Initial Catalog=mydb;Persist Security Info=True;User ID=sa;Password=123456";
            DbHelper db = new DbHelper(strConn);
            DbCommand cmd = db.GetSqlStringCommond("update mrp set [订单数量] = 555 where [产品型号] = @p");
            db.AddParamter(cmd, "@p", "D0001");
            DataTable dt = db.ExecuteDataTable(cmd);

            string strsql = "select * from Users(nolock) where ','+@UserID+',' like  '%,'+ltrim(str(UserID))+',%' ";

            Console.WriteLine(strsql);

            //string fileName = "c:\\qiu.xls";
            //ExcelHelper_Npoi.ExportDataTableToExcel(dt, "abc",fileName );
            //Console.WriteLine("从DataTable导出数据至" + fileName);

            //DataTable dtExcel = ExcelHelper_Npoi.ImportExcelToDataTable(fileName, 0, 0);
            //Console.WriteLine(dtExcel.Rows.Count);

            #endregion

            #region BubbleSort
            //int[] array= {19,34,2,54,24,6,77,33};
            //Sort.BubbleSort(array);
            //array.ToList<int>().ForEach(arr => Console.WriteLine(arr));
            #endregion

            #region QuickSort
            //int[] array = { 19, 34, 2, 54, 24, 6, 77, 33 ,4};
            //Sort.QuickSort(array, 0, array.Length);
            //array.ToList<int>().ForEach(arr => Console.WriteLine(arr));
            #endregion

            #region StringJoiner
            //StringJoiner str = "abc";
            //str = str + "123";
            //Console.WriteLine(str.ToString());
            #endregion

            Console.Read();
        }
    }
}
